package com.zf.yichat.mapper;

import com.zf.yichat.base.FsMapper;
import com.zf.yichat.dto.ChatroomMemberUserDto;
import com.zf.yichat.dto.UserJoinChatroomDto;
import com.zf.yichat.model.User;
import com.zf.yichat.model.UserJoinChatroom;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserJoinChatroomMapper extends FsMapper<UserJoinChatroom> {


    /**
     *  查询用户是否已申请过进入该聊天室
     * @param userId
     * @param chatroomId
     * @return
     */
    UserJoinChatroom queryApplyForChatroom(@Param("userId") Long userId,@Param("chatroomId") String chatroomId);

    /**
     * 根据用户信息查询所属聊天室内的成员信息
     * @param chatroomId
     * @param appid
     * @param nick
     * @return
     */
    List<User> queryUserByParam(@Param("chatroomId") String chatroomId, @Param("appId") String appid,@Param("nick") String nick);

    /**
     * 用户申请加入聊天室列表
     * @return
     */
    List<UserJoinChatroomDto> selectList();

    UserJoinChatroom queryUserInChatroom(@Param("userId") Long userId, @Param("chatroomId") String chatroomId);

    List<ChatroomMemberUserDto> queryChatroomMember(@Param("chatroomId") String chatroomId,@Param("userId") String userId,
                                                    @Param("nick") String nick,@Param("mobile") String mobile,
                                                    @Param("realName") String realName);

    int deleteChatroomMember(@Param("chatroomId") String chatroomId, @Param("userId") String userId);

    /**
     * 查询用户是否在聊天室内（内部使用，所以userId传输的是明文）
     * @param chatroomId
     * @param userId
     * @return
     */
    Integer queryUserJoinChatroom( @Param("chatroomId") String chatroomId, @Param("userId") String userId);

 }